package stack;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Stack{
    int index;
    char stack[]=new char[100];

    Stack(){
        index=0;
    }

    public void push(char c){
        stack[index]=c;
        index++;
    }

    public char pop(){
        index--;
        return stack[index];
    }

     public boolean empty()
        {
            return index == 0;
        }
}

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String str = in.readLine();
        Stack s=new Stack();
        char c;
        int i;
        for(i=0; i<str.length();i++){
            if((str.charAt(i)=='(')||(str.charAt(i)=='{')||(str.charAt(i)=='[')) s.push(str.charAt(i));  
            else if((str.charAt(i)==')')||(str.charAt(i)=='}')||(str.charAt(i)==']')){
                if(s.empty()){
                    System.out.println("Ne hvataet skobok");
                    break;
                }
                c=s.pop();
                if((c=='{')&&(str.charAt(i)=='}')||(c=='(')&&(str.charAt(i)==')')||(c=='[')&&(str.charAt(i)==']')) continue;
                else{
                    System.out.println("Neverni tip skobok");
                    break;
                }
            }
            else continue;          
        }
        if(!s.empty()&&i==str.length())System.out.println("Ne hvataet zakrivayshih skobok");
    }
}
